#pragma once

#include "condition.h"


namespace BAA
{

	class Action_FRIEND_Threaten:public Action
	{
	public:


		Action_FRIEND_Threaten(Vector2 * range):Action("threaten")
		{
			mRange.x = range->x;
			mRange.y = range->y;

			mAngerFactor = 0.5;
			mLikeFactor = 0.8;
			mPowerFactor = 0.7;
			mVengeance = 0.7;
		}


		virtual void PrepareConditions()
		{
			// nothing to do to run.
		}

		virtual float CalculateStateUtility()
		{
			AgentProperties * properties = mRoleParent->Self()->Properties();

			// this could be a condition rather then calculated during the utility
			Emotion * anger = (*mRoleParent->Emotions())["anger"];
			Emotion * like =  (*mRoleParent->Emotions())["like"];

			if(anger == NULL || like == NULL)
				return 0.0f;


			// average out anger
			float anger = (properties->mAnger->GetValue() + anger.GetValue())/ 2.0f;
			

			// threaten your friend when your very angry
			float emotionUtility = abs(mAngerFactor - anger) -
								   abs(mLikeFactor - like->GetValue());

			float personalityUtility = 0.0f;

			return MathHelper.clamp(&mRange,emotionUtility + (0.5f)*personalityUtility);



		}






		~Action_FRIEND_Threaten()
		{

		}

	protected:
		// any members

		Vector2 mRange;

		float mAngerFactor;
		float mLikeFactor;
		float mPowerFactor;
		float mVengeance;
	};// end class
}// end namespace
